<template>
  <LdbpPage
    pageName="zdyq"
    zh_name="招大引强"
    :rankList_title="rankList_title"
    :rankList_th="rankList_th"
    :rankList_4="rankList_4"
    :rankList_6="rankList_6"
    :rankList_8="rankList_8"
    :info="info"
  ></LdbpPage>
</template>

<script>
import axios from 'axios'
import LdbpPage from '../../components/LdbpPage'

export default {
  name: 'Zdyq',
  components: { LdbpPage },
  data() {
    return {
      info: '以项目储备大比拼，项目推进大比拼，重大项目大比拼围绕重大项目，外资等目标任务形成比学赶超的良好氛围，进一步提升招商项目质量，全面落实招商引资在杭州市的考核目标。',
      rankList_title: ['重大项目榜', '项目推进榜', '项目储备榜', '外资榜'],
      rankList_th: [
        ['', '', '总分'],
        ['', '', '总分'],
        ['', '', '总分'],
        ['', '', '实到外资(万美元)']
      ],
      rankList_4: [],
      rankList_6: [],
      rankList_8: [],
    };
  },
  mounted() {
    // 四月
    this.request('/BigStrong/getGreatProjectList', '4', 0) // 重大项目榜
    this.request('/BigStrong/getProjectBoostList', '4', 1) // 项目推进榜
    this.request('/BigStrong/getProjectStorageList', '4', 2) // 项目储备榜
    this.request('/mathStatistics/getForeign', '4', 3) // 外资榜
    // 六月
    this.request('/BigStrong/getGreatProjectList', '6', 0)
    this.request('/BigStrong/getProjectBoostList', '6', 1)
    this.request('/BigStrong/getProjectStorageList', '6', 2)
    this.request('/mathStatistics/getForeign', '6', 3)
    // 八月
    this.request('/BigStrong/getGreatProjectList', '8', 0)
    this.request('/BigStrong/getProjectBoostList', '8', 1)
    this.request('/BigStrong/getProjectStorageList', '8', 2)
    this.request('/mathStatistics/getForeign', '8', 3)
  },
  methods: {
    request(url, month, index) {
      // 月份参数处理
      let newMonth;
      if (month === '6') {
        newMonth = '5-6'
      }
      if (month === '8') {
        newMonth = '7'
      }
      axios({
        method: 'post',
        url: 'https://lst.jiande.gov.cn:8443/competition_jiande' + url,
        headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
        params: { month: newMonth || month }
      })
        .then(({data: {data}}) => {
          console.log('res', month, data);
          if (data) {
            this['rankList_' + month][index] = data
          }
        })
        .catch(err => {
          console.log('err', err);
        });
    }
  }
};
</script>